package com.winsdom.mapper;

import com.winsdom.dto.AccountInformationDTO;
import com.winsdom.entity.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.winsdom.vo.AccountInformationVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author
 * @since 2025-05-12
 */
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
    /**
     * 查询账号
     * @param accountInformationDTO
     * @return
     */
    List<AccountInformationVO> getAllAccount(AccountInformationDTO accountInformationDTO);

    /**
     * 查询总记录数
     * @param accountInformationDTO
     * @return
     */
    Long selectTotalCount(AccountInformationDTO accountInformationDTO);


    /**
     * 查询某分类下的用户数量
     * @param categoryId
     * @return
     */
    @Select("select count(1) from sys_user where category_id = #{categoryId}")
    int countUsersByCategoryId(Long categoryId);

    /**
     * 根据手机号查询用户
     * @param phone
     * @return
     */
    @Select("select * from sys_user where phone = #{phone}")
    SysUser selectByPhone(String phone);
}
